package com.ffcs.ffxtc.modules.base.domin.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ffcs.utils.CustomDataDeserializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author 张正兴
 * @since 2024-04-30
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("drawdb_data")
@Schema(name = "DrawdbData")
public class DrawdbData extends Model<DrawdbData> {
    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @TableField("name")
    @Schema(description = "名称")
    private String name;

    @TableField("data")
    @Schema(description = "数据")
    private String data;

    @TableField(exist = false)
    @Schema(description = "是否分享")
    private Boolean isShare;

    @TableField("drawdb_user_id")
    @Schema(description = "用户ID")
    private Long drawdbUserId;

    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;

    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private String createdBy;

    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;

    @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
    private String updatedBy;

    public static final String ID = "id";

    public static final String NAME = "name";

    public static final String DATA = "data";

    public static final String CREATED_TIME = "created_time";

    public static final String CREATED_BY = "created_by";

    public static final String UPDATED_TIME = "updated_time";

    public static final String UPDATED_BY = "updated_by";

    public static final String DRAWDB_USER_ID = "drawdb_user_id";

    @Override
    public Serializable pkVal() {
        return this.id;
    }
}
